// MESSAGE TRACKER_STATUS support class

#pragma once

namespace mavlink {
namespace fppa {
namespace msg {

/**
 * @brief TRACKER_STATUS message
 *
 * Status of satellite tracker if available.
 */
struct TRACKER_STATUS : mavlink::Message {
    static constexpr msgid_t MSG_ID = 31;
    static constexpr size_t LENGTH = 58;
    static constexpr size_t MIN_LENGTH = 58;
    static constexpr uint8_t CRC_EXTRA = 2;
    static constexpr auto NAME = "TRACKER_STATUS";


    uint64_t time_boot_ms; /*< [ms] Timestamp (time since system boot). */
    uint8_t mode; /*<  Current mode */
    uint8_t auto_pos; /*<  true:position from gps.false:position from manual. */
    float slon; /*< [deg] satellite orbit. */
    float polar; /*< [deg] polar angle.(-90.0..90.0)(deg) */
    float llon; /*< [deg] local longitude. */
    float llat; /*< [deg] local latitude. */
    float res1; /*<  res1. */
    float res2; /*<  res2. */
    float res3; /*<  res3. */
    float res4; /*<  res4. */
    float res5; /*<  res5. */
    float res6; /*<  res6. */
    uint32_t res7; /*<  res7. */
    uint32_t sat_id; /*<  satellite ID. */


    inline std::string get_name(void) const override
    {
            return NAME;
    }

    inline Info get_message_info(void) const override
    {
            return { MSG_ID, LENGTH, MIN_LENGTH, CRC_EXTRA };
    }

    inline std::string to_yaml(void) const override
    {
        std::stringstream ss;

        ss << NAME << ":" << std::endl;
        ss << "  time_boot_ms: " << time_boot_ms << std::endl;
        ss << "  mode: " << +mode << std::endl;
        ss << "  auto_pos: " << +auto_pos << std::endl;
        ss << "  slon: " << slon << std::endl;
        ss << "  polar: " << polar << std::endl;
        ss << "  llon: " << llon << std::endl;
        ss << "  llat: " << llat << std::endl;
        ss << "  res1: " << res1 << std::endl;
        ss << "  res2: " << res2 << std::endl;
        ss << "  res3: " << res3 << std::endl;
        ss << "  res4: " << res4 << std::endl;
        ss << "  res5: " << res5 << std::endl;
        ss << "  res6: " << res6 << std::endl;
        ss << "  res7: " << res7 << std::endl;
        ss << "  sat_id: " << sat_id << std::endl;

        return ss.str();
    }

    inline void serialize(mavlink::MsgMap &map) const override
    {
        map.reset(MSG_ID, LENGTH);

        map << time_boot_ms;                  // offset: 0
        map << slon;                          // offset: 8
        map << polar;                         // offset: 12
        map << llon;                          // offset: 16
        map << llat;                          // offset: 20
        map << res1;                          // offset: 24
        map << res2;                          // offset: 28
        map << res3;                          // offset: 32
        map << res4;                          // offset: 36
        map << res5;                          // offset: 40
        map << res6;                          // offset: 44
        map << res7;                          // offset: 48
        map << sat_id;                        // offset: 52
        map << mode;                          // offset: 56
        map << auto_pos;                      // offset: 57
    }

    inline void deserialize(mavlink::MsgMap &map) override
    {
        map >> time_boot_ms;                  // offset: 0
        map >> slon;                          // offset: 8
        map >> polar;                         // offset: 12
        map >> llon;                          // offset: 16
        map >> llat;                          // offset: 20
        map >> res1;                          // offset: 24
        map >> res2;                          // offset: 28
        map >> res3;                          // offset: 32
        map >> res4;                          // offset: 36
        map >> res5;                          // offset: 40
        map >> res6;                          // offset: 44
        map >> res7;                          // offset: 48
        map >> sat_id;                        // offset: 52
        map >> mode;                          // offset: 56
        map >> auto_pos;                      // offset: 57
    }
};

} // namespace msg
} // namespace fppa
} // namespace mavlink
